package com.cgx.tablet.beeper.utils.pay;

/**
 * 微信支付回调用的工具类
 * 使用单例模式实现回调
 * Created by admin on 2016/10/17.
 */
public class WeChatPayUtil {

    private volatile static WeChatPayUtil instance = null;

    public static WeChatPayUtil getInstance(){
        if (instance == null){
            synchronized (WeChatPayUtil.class){
                if (instance == null)
                    instance = new WeChatPayUtil();
            }
        }
        return instance;
    }

    public interface WeChatPayListener{
        void onWeChatPaySuccess();
        void onWeChatPayFail(String msg);
    }

    private WeChatPayListener payListener;

    public void setPayListener(WeChatPayListener payListener) {
        this.payListener = payListener;
    }

    public void onPaySuccess(){
        if (payListener != null)
            payListener.onWeChatPaySuccess();
    }

    public void onPayFail(String msg){
        if (payListener != null)
            payListener.onWeChatPayFail(msg);
    }

}
